<%@page import="com.xnx3.j2ee.Global"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>  
<%@ taglib uri="http://www.xnx3.com/java_xnx3/xnx3_tld" prefix="x" %>
<jsp:include page="/store/common/head.jsp">
	<jsp:param name="name" value="未取订单列表"/>
</jsp:include>
<script src="/<%=Global.CACHE_FILE %>Order_state.js"></script>
<style>
.product-buyer-name {
	max-width: 110px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
</style>
<div style="height:10px;"></div>
<jsp:include page="/wm/common/list/formSearch_formStart.jsp" ></jsp:include>
	<jsp:include page="/wm/common/list/formSearch_input.jsp">
		<jsp:param name="iw_label" value="骑手姓名" />
		<jsp:param name="iw_name" value="qishou_name" />
	</jsp:include>
	<a class="layui-btn" href="javascript:wm.list(1);" style="margin-left: 15px;">搜索</a>
	<a class="layui-btn" onclick="getChengdanExecl();" >导出excel</a>
</form>
<div class="tabox" style="padding:0 20px;min-width: 2000px;">
<table class="aui-table-responsive layui-table iw_table" style="min-width: 2000px;">
	<thead>
		<tr>
			<th width="100px" style= "text-align:center">订单号</th>
			<th width="140px" style= "text-align:center">预约时间</th>
			<th width="100px" style= "text-align:center">出售人姓名</th>
			<th width="100px" style= "text-align:center">出售人手机号</th>
			<th width="100px" style= "text-align:center">骑手姓名</th>
			<th width="100px" style= "text-align:center">骑手电话</th>
			<th width="150px" style= "text-align:center">所属网格名称</th>
			<th width="150px" style= "text-align:center">所属代理商名称</th>
			<th width="100px" style= "text-align:center">服务状态</th>
			<th width="200px" style= "text-align:center">备注</th>
			<th width="100px" style= "text-align:center">取件信息</th>
		</tr> 
	</thead>
	<tbody>
		<tr v-for="item in list">
			<td>{{item.no}}</td>
			<td>{{formatTime(item.reserveStartTime,'Y-M-D h:m')}}~{{formatTime(item.reserveEndTime,'h:m')}}</td>
			<td>{{item.username}}</td>
			<td>{{item.phone}}</td>
			<td>{{item.qishouName}}</td>
			<td>{{item.qishouPhone}}</td>
			<td>{{item.wanggeUsername}}</td>
			<td>{{item.dailishangUsername}}</td>
			<td>{{state[item.state]}}</td>
			<td class="product-buyer-name">{{item.remark}}</td>
			<td style="width: 150px;">
				<botton class="layui-btn layui-btn-sm" :onclick="'seeGoods('+item.id+', \''+item.no+'\');'" style="margin-left: 3px;">订单详情</botton>
				<botton class="layui-btn layui-btn-sm" :onclick="'orderGoodsDetails('+item.id+', \''+item.no+'\');'" style="margin-left: 3px;">商品详情</botton>
			</td> 
		</tr>
	</tbody>
</table>
</div>
<!-- 通用分页跳转 -->
<jsp:include page="/wm/common/page.jsp" />

<script type="text/javascript">
//自适应弹出层大小
var index = parent.layer.getFrameIndex(window.name); //获取窗口索引

//查看订单详情
function seeGoods(id,no){
	 layer.open({
		type: 2,
		title:'查看订单详情',
		area: ['500px', '700px'],
		shadeClose: true, //开启遮罩关闭
		content: '/superadmin/order/orderDetails.jsp?id=' + id
	});
}
//查看订单商品信息
function orderGoodsDetails(id,no){
	 layer.open({
		type: 2,
		title:'查看订单号['+no+']商品信息',
		area: ['50%', '80%'],
		shadeClose: true, //开启遮罩关闭
		content: '/superadmin/order/orderGoodsDetails.jsp?id=' + id
	});
}

/**
 * 对象转url参数
 * @param {*} data,对象
 * @param {*} isPrefix,是否自动加上"?"
 */
function queryParams(data = {}, isPrefix = true, arrayFormat = 'brackets') {
    let prefix = isPrefix ? '?' : ''
    let _result = []
    if (['indices', 'brackets', 'repeat', 'comma'].indexOf(arrayFormat) == -1) arrayFormat = 'brackets';
    for (let key in data) {
        let value = data[key]
        // 去掉为空的参数
        if (['', undefined, null].indexOf(value) >= 0) {
            continue;
        }
        // 如果值为数组，另行处理
        if (value.constructor === Array) {
            // e.g. {ids: [1, 2, 3]}
            switch (arrayFormat) {
                case 'indices':
                    // 结果: ids[0]=1&ids[1]=2&ids[2]=3
                    for (let i = 0; i < value.length; i++) {
                        _result.push(key + '[' + i + ']=' + value[i])
                    }
                    break;
                case 'brackets':
                    // 结果: ids[]=1&ids[]=2&ids[]=3
                    value.forEach(_value => {
                        _result.push(key + '[]=' + _value)
                    })
                    break;
                case 'repeat':
                    // 结果: ids=1&ids=2&ids=3
                    value.forEach(_value => {
                        _result.push(key + '=' + _value)
                    })
                    break;
                case 'comma':
                    // 结果: ids=1,2,3
                    let commaStr = "";
                    value.forEach(_value => {
                        commaStr += (commaStr ? "," : "") + _value;
                    })
                    _result.push(key + '=' + commaStr)
                    break;
                default:
                    value.forEach(_value => {
                        _result.push(key + '[]=' + _value)
                    })
            }
        } else {
            _result.push(key + '=' + value)
        }
    }
    return _result.length ? prefix + _result.join('&') : ''
}

//导出execl
function getChengdanExecl(){
	var data = wm.getJsonObjectByForm($('.toubu_xnx3_search_form'));
	 window.open('/superadmin/outdoc/getNotTakenListExecl.json' + queryParams(data)); 
} 

//刚进入这个页面，加载第一页的数据
wm.list(1,'/superadmin/order/notTakenList.json');
</script>
<jsp:include page="/wm/common/foot.jsp"></jsp:include>